// hyb_yl/doc_answer_detail/doc_answer_detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //问答
  wenda: [{ id: 0, img: "/hyb_yl/images/header_01.png", niming: "匿名用户", state: 0, con: "返几块大水井坊莱克斯顿解放路卡发链接为发胜利大街发狂了三解放路开始就流口水的解放路看电视", states: 1, imgArr: ["/hyb_yl/images/background.png", "/hyb_yl/images/background.png", "/hyb_yl/images/background.png", "/hyb_yl/images/background.png", "/hyb_yl/images/background.png", "/hyb_yl/images/background.png", "/hyb_yl/images/background.png", "/hyb_yl/images/background.png"] }],
    //专家回答
    doctor:[
      { id: 1, image: "/hyb_yl/images/header_02.png", zhuan: "小猪佩奇", zhi: "主治医师", con1: "就得上来咖啡吉林省脸上法律手段放假了设计费雷克萨发了扣三分", time: "4天前" },
      { id: 1, image: "/hyb_yl/images/header_02.png", zhuan: "小猪佩奇", zhi: "主治医师", con1: "就得上来咖啡吉林省脸上法律手段放假了设计费雷克萨发了扣三分", time: "4天前" },
      ],
    overflow:false,
    paySH:false,
    values:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    if(options.con){
      var con = options.con
      var obj = {}
      obj.id = 1
      obj.image = "/hyb_yl/images/header_02.png"
      obj.zhuan = "小猪佩奇"
      obj.zhi = "主治医师"
      obj.con1 = con
      obj.time = "刚刚"
      var doctor = that.data.doctor
      doctor.push(obj)
      that.setData({
        doctor: doctor
      })
    }
  },
  // 开关
  switchChange: function (e) {
    var that = this
    console.log('switch2 发生 change 事件，携带值为', e.detail.value)
    if(!e.detail.value){
      var values = ""
    }else{
      var values = that.data.values
    }
    this.setData({
      paySH: e.detail.value,
      values: values
    })
  },
  //展示
  docAnswerClick:function(){
    wx.navigateTo({
      url: '/hyb_yl/userLife/pages/doc_answer/doc_answer',
    })
  },
  payClick:function(e){
    console.log(e)
    this.setData({
      values:e.detail.value
    })
  },
  // hideClick:function(){
  //   this.setData({
  //     overflow: false
  //   })
  // },

  //预览
  yulan:function(e){
    var that = this
    var idx = e.currentTarget.dataset.idx
    var wenda = that.data.wenda
    console.log(idx, wenda)
    wx.previewImage({
      current: wenda[0].imgArr[idx], // 当前显示图片的http链接
      urls: wenda[0].imgArr,
    })
  },
  //确认
  confirm:function(){
    wx.showLoading({
      title: '',
    })
    setTimeout(function(){
        wx.hideLoading()
        wx.showToast({
          title: '保存成功',
        })
    },500)
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})